home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / bbs / tigerfix.zip / WTCHNEWS.PRG < prev    next >
Text File  |  1996-05-22  |  30KB  |  777 lines

  1. *--------------------------------------------------------------------------*
  2. *--------------------------------------------------------------------------*
  3. *                                                                          *
  4. *                                PRUNEIN                                   *
  5. *                                                                          *
  6. *                      (c) 1993 by Bernal Schooley                         *
  7. *                          and Advanced Designs                            *
  8. *                                                                          *
  9. *    This program is being released as SHAREware!  Please REGISTER it if   *
  10. *    you decide to use it in ANY way.  A LOT of work has gone into this    *
  11. *    and is available to you now because OTHER people have SUPPORTED the   *
  12. *    development of this and other TDBS software by Advanced Designs.      *
  13. *                                                                          *
  14. *    I ask YOU to be among those who support this and future developments  *
  15. *    by REGISTERING PRUNE.  Registration is ONLY $25.00 and will allow     *
  16. *    you to recieve technical support and will give you a feeling of       *
  17. *    satisfaction in knowing that your supporting the efforts of a         *
  18. *    struggling third party TDBS developer. ;)                             *
  19. *                                                                          *
  20. *                                     Thank you!                           *
  21. *                                     --Bernal Schooley                    *
  22. *                                       Advanced Designs                   *
  23. *                                       217-344-9145     (voice)           *
  24. *                                       217-367-1710     (support bbs)     *
  25. *                                       bernal@unity.com (internet)        *
  26. *                                                                          *
  27. *--------------------------------------------------------------------------*
  28. *--------------------------------------------------------------------------*
  29. *                                                                          *
  30. *    If you need additional function added to this program and are unable, *
  31. * or simply don't have enough time, to do it yourself, you may call        *
  32. * Bernal Schooley for a quote on custom programming services!  Average     *
  33. * hourly rates for short to medium term contracts are $40.00.  This amount *
  34. * can vary based on complexity, onsite or offsite, and length of overall   *
  35. * contract.                                                                *
  36. *                                                                          *
  37. *--------------------------------------------------------------------------*
  38. *--------------------------------------------------------------------------*
  39.  
  40.  
  41. CLEAR
  42.  
  43. ** Load path variables from the TIGER.CTL file
  44.  
  45.    FOPEN handle "\TBBS\TIGER.CTL" 10 FMAXLEN()
  46.    FLFIND handle pos "UUCPIN:" 1
  47.    FLREAD handle bytes data
  48.    uucpin = UPPER(LTRIM(RTRIM(CRTRIM(SUBSTR(data,AT("UUCPIN:",UPPER(data))+8)))))
  49.    FSEEK handle pos 0 0
  50.    FLFIND handle pos "UUCPIN-STAGE:" 1
  51.    FLREAD handle bytes data
  52.    stagein = UPPER(LTRIM(RTRIM(CRTRIM(SUBSTR(data,AT("UUCPIN-STAGE:",UPPER(data))+14)))))
  53.    FSEEK handle pos 0 0
  54.    FLFIND handle pos "HOST:" 1
  55.    FLREAD handle bytes data
  56.    host = UPPER(LTRIM(RTRIM(CRTRIM(SUBSTR(data,AT("HOST:",UPPER(data))+6)))))
  57.    FSEEK handle pos 0 0
  58.    FLFIND handle pos "UUCPNAME:" 1
  59.    FLREAD handle bytes data
  60.    uucpname = UPPER(LTRIM(RTRIM(CRTRIM(SUBSTR(data,AT("UUCPNAME:",UPPER(data))+10)))))
  61.    FCLOSE handle
  62.  
  63.  
  64. ** Check for TIGRBUSY or MAILBUSY flags
  65.  
  66.    DO WHILE .T.
  67.       IF FILE(stagein+"TIGRBUSY") .OR. FILE(uucpin+"TIGRBUSY")
  68.          CLEAR
  69.          ? "Directories in use..."
  70.          ? "PRUNEOUT waiting on TIGRBUSY flags..."
  71.       ELSE
  72.          IF FILE(stagein+"MAILBUSY") .OR. FILE(uucpin+"MAILBUSY")
  73.             CLEAR
  74.             ? "Directories in use..."
  75.             ? "PRUNEOUT waiting on MAILBUSY flags..."
  76.          ELSE
  77.             EXIT
  78.          ENDIF
  79.       ENDIF
  80.       ?
  81.       ? "(Press [A] to abort or [D] to delete busy flags and begin.)"
  82.       char = INKEY(10)
  83.       IF char = 65 .OR. char = 97
  84.          QUIT
  85.       ENDIF
  86.       IF char = 68 .OR. char = 100
  87.          IF FILE(stagein+"TIGRBUSY")
  88.             temp = stagein + "TIGRBUSY"
  89.             ERASE &temp
  90.          ENDIF
  91.          IF FILE(uucpin+"TIGRBUSY")
  92.             temp = uucpin + "TIGRBUSY"
  93.             ERASE &temp
  94.          ENDIF
  95.          IF FILE(stagein+"MAILBUSY")
  96.             temp = stagein + "MAILBUSY"
  97.             ERASE &temp
  98.          ENDIF
  99.          IF FILE(uucpin+"MAILBUSY")
  100.             temp = uucpin + "MAILBUSY"
  101.             ERASE &temp
  102.          ENDIF
  103.          EXIT
  104.       ENDIF
  105.    ENDDO
  106.  
  107. ** All clear... write busy files to lock directories and begin
  108.  
  109.    ? "PRUNEIN - Working..."
  110.    in_busy   = uucpin+"MAILBUSY"
  111.    out_busy  = stagein+"MAILBUSY"
  112.    FCREATE handle &in_busy 3  
  113.    FCLOSE handle
  114.    FCREATE handle &out_busy 3
  115.    FCLOSE handle
  116.  
  117. ** Load "keep" array from PRUNE.CFG for use while pruning
  118.  
  119.    max = 20
  120.    PUBLIC keep[max]                                      
  121.    keep[1] = "From:"
  122.    keep[2] = "Reply-To:"
  123.    keep[3] = "Subject:"
  124.    
  125.    FOPEN handle PRUNE.CFG 10 FMAXLEN()
  126.    FLFIND handle pos "PRUNE-METHOD:" 1
  127.    FLREAD handle bytes data
  128.    method = UPPER(LTRIM(RTRIM(CRTRIM(SUBSTR(data,AT("PRUNE-METHOD:",UPPER(data))+14)))))
  129.    FSEEK handle pos 0 0
  130.    FLFIND handle pos "ACCOUNTING:" 1
  131.    FLREAD handle bytes data
  132.    accounting = UPPER(LTRIM(RTRIM(CRTRIM(SUBSTR(data,AT("ACCOUNTING:",UPPER(data))+12)))))
  133.    ** More variables could be loaded from the CFG file by adding code like
  134.    ** the following:
  135.    *
  136.    * FSEEK handle pos 0 0
  137.    * FLFIND handle pos "[another keyword]:" 1
  138.    * FLREAD handle bytes data
  139.    * [new variable] = UPPER(LTRIM(RTRIM(CRTRIM(SUBSTR(data,AT("[keyword as above]:",UPPER(data))+14)))))
  140.    
  141.    FSEEK handle pos 0 0                                       
  142.    FLFIND handle pos "KEEP:" 1
  143.    FLREAD handle bytes data
  144.    FLREAD handle bytes data
  145.    top = 3
  146.    DO WHILE data # "ENDKEEP:" .AND. bytes > 0 .AND. top < max
  147.       top = top + 1
  148.       keep[top] = LTRIM(RTRIM(CRTRIM(data)))
  149.       FLREAD handle bytes data
  150.    ENDDO
  151.    FCLOSE handle
  152.  
  153.  
  154. ** Perform pruning on all .D files in the stagein directory
  155.  
  156.    xfile  = FINDFIRST(fnd_nxt, stagein+"*.X")
  157.    xfilep = stagein+xfile
  158.    DO WHILE LEN(xfile) > 0
  159.  
  160.     ** open the .X file
  161.  
  162.       FOPEN handle &xfilep 10 FMAXLEN()/2
  163.  
  164.       ** Read "F" line to find the file name
  165.  
  166.       FLFIND handle pos "F "
  167.       IF pos < 1
  168.          FCLOSE handle
  169.          tofile = STUFF(xfilep,AT(".X",xfilep),2,".X!!")
  170.          RENAME &xfilep TO &tofile
  171.          xfile  = FINDNEXT(fnd_nxt)
  172.          xfilep = stagein+xfile
  173.          LOOP
  174.       ENDIF
  175.  
  176.       FLREAD handle bytes data
  177.       data = RTRIM(CRTRIM(data))
  178.       IF LEN(data) < 6 .OR. .NOT. "D." $ UPPER(data)
  179.          FCLOSE handle
  180.          tofile = STUFF(xfilep,AT(".X",xfilep),2,".X!!")
  181.          RENAME &xfilep TO &tofile
  182.          xfile  = FINDNEXT(fnd_nxt)
  183.          xfilep = stagein+xfile
  184.          LOOP
  185.       ENDIF
  186.  
  187.       ** calculate the .D file name
  188.  
  189.       dfile = RTRIM(CRTRIM(SUBSTR(data,AT("D.",UPPER(data))+2)))
  190.  
  191.       ** Calculate the first letter of a .D waffle file *******
  192.     
  193.       y = 1
  194.       tryhost = .T.
  195.       tryuucp = .T.
  196.       lenh = LEN(host)
  197.       lenu = LEN(uucpname)
  198.        
  199.       DO WHILE y > 0
  200.          IF y <= lenh .AND. tryhost
  201.             IF UPPER(LEFT(dfile,1)) = SUBSTR(host,y,1)
  202.                dfile = SUBSTR(dfile,2)
  203.                y = y + 1
  204.                LOOP
  205.             ELSE            
  206.                IF tryuucp
  207.                   tryhost = .F.
  208.                ELSE
  209.                   exit
  210.                ENDIF 
  211.             ENDIF
  212.          ELSE
  213.             tryhost = .F.
  214.             IF .NOT. tryuucp
  215.                exit
  216.             ENDIF    
  217.